import request from '../api/request.js'
import Tools from '../utils/index.js'


export default {
	initToken(state, payload) {
		const localToken = Tools.getStorage('myShare_token'), localUserInfo = Tools.getStorage('myShare_userInfo')
        if(localUserInfo) {
			localUserInfo.mobile = localUserInfo.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
		}
		state.token = payload || localToken || null
		state.userInfo =  localUserInfo || null
	},
	loginShow(state, bool) { 
		state.loginShow = bool ||  Tools.getStorage('loginShow')
	},
	loginOut(state) {
		state.token = null
		state.userInfo = null
		storage.removeStorage('token')
	},
	freshActivite(state, bool) {
		state.freshActivite = bool;
	},
	isShowGet(state, bool) {
		state.isShowGet = bool;
	}
}
